# -*- coding: utf-8 -*-

"""
@Author: 芮芪懿 QQ1849433491
@Project->File: pygame_train -> game_public.py
@IDE：PyCharm
@File: game_public.py
@Datetime: 2021/7/9 21:19
"""
import pygame
from pygame import Rect  # 矩形类


def init_pygame():
    """
    初始化pygame
    :return:
    """
    pygame.init()
    pygame.mixer.init()
    pass


def update_screen():
    """
    update 更新屏幕显示背景图片
    :return:
    """
    pygame.display.update()
    pass


def load_image_resource(path=""):
    """
    加载图片资源
    :param path: 图片路径
    :return: 图片资源
    """
    return pygame.image.load(path)
    pass


def load_sound_resource(path=""):
    """
    加载音频资源
    :param path: 音频路径
    :type path:str
    :return: 音频对象
    """
    return pygame.mixer.Sound(path)
    pass


def create_rect(x: int = 0, y: int = 0, width: int = 0, height: int = 0):
    """
    创建矩形
    :param x:
    :param y:
    :param width:
    :param height:
    :return:
    """
    return Rect(x, y, width, height)
